﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Tools;

namespace Punia
{
    [CommandAttribute(false)]
    public partial class drop_certificate : BaseForm
    {
        public drop_certificate()
            : base()
        {
        }

        public drop_certificate(DbContext dbContext)
            : base(dbContext)
        {
            InitializeComponent();

            cbCertif.DataSource = Utility.certificates(dbContext);
            cbCertif.DisplayMember = "Name";
        }

        protected override void Write()
        {
            StringBuilder sb = new StringBuilder();

            if (cbCertif.SelectedIndex > 0)
                sb.AppendLine("DROP CERTIFICATE [" + cbCertif.Text + "]");

            tbCommand.Text = sb.ToString();
        }

        private void cbCertif_SelectedIndexChanged(object sender, EventArgs e)
        {
            Write();
        }
    }
}